package org.brain.pojos;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Treemenu entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "TREEMENU", schema = "PUBLIC", catalog = "PUBLIC")
public class Treemenu implements java.io.Serializable {

	// Fields

	private Integer nodeid;
	private User user;
	private String nodename;
	private Integer childnode;
	private Integer fathernode;
	private Set<Document> documents = new HashSet<Document>(0);

	// Constructors

	/** default constructor */
	public Treemenu() {
	}

	/** minimal constructor */
	public Treemenu(User user, String nodename) {
		this.user = user;
		this.nodename = nodename;
	}

	/** full constructor */
	public Treemenu(User user, String nodename, Integer childnode,
			Integer fathernode, Set<Document> documents) {
		this.user = user;
		this.nodename = nodename;
		this.childnode = childnode;
		this.fathernode = fathernode;
		this.documents = documents;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "NODEID", unique = true, nullable = false)
	public Integer getNodeid() {
		return this.nodeid;
	}

	public void setNodeid(Integer nodeid) {
		this.nodeid = nodeid;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "USERNAME", nullable = false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "NODENAME", nullable = false, length = 10)
	public String getNodename() {
		return this.nodename;
	}

	public void setNodename(String nodename) {
		this.nodename = nodename;
	}

	@Column(name = "CHILDNODE")
	public Integer getChildnode() {
		return this.childnode;
	}

	public void setChildnode(Integer childnode) {
		this.childnode = childnode;
	}

	@Column(name = "FATHERNODE")
	public Integer getFathernode() {
		return this.fathernode;
	}

	public void setFathernode(Integer fathernode) {
		this.fathernode = fathernode;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "treemenu")
	public Set<Document> getDocuments() {
		return this.documents;
	}

	public void setDocuments(Set<Document> documents) {
		this.documents = documents;
	}

}